/*
 *  MidiNote.cpp
 *  MusicAnalyzer
 *
 *  Created by jiro on 12/03/30.
 *  Copyright 2012 jiro music. All rights reserved.
 *
 */


#include "MidiNote.h"
#include <sstream>

namespace sc
{

	std::string MidiNote::ToString( MidiNote::Number number )
	{
		std::stringstream ss;
		int divisor = number / 12;
		int remainder = number % 12;  
		switch ( remainder )
		{
		case 0:
			ss << "C";
			break;
		case 1:
			ss << "C#";
			break;
		case 2:
			ss << "D";
			break;
		case 3:
			ss << "D#";
			break;
		case 4:
			ss << "E";
			break;
		case 5:
			ss << "F";
			break;
		case 6:
			ss << "F#";
			break;
		case 7:
			ss << "G";		
			break;
		case 8:
			ss << "G#";
			break;
		case 9:
			ss << "A";
			break;
		case 10:
			ss << "A#";
			break;
		case 11:
			ss << "B";
			break;
		}
		ss << divisor - 1;
		return ss.str();
	}


}